3.12.91 \(\int (a+b \tan (e+f x))^3 (c+d \tan (e+f x)) \, dx\) [1191]

3.12.91.1 Optimal result
3.12.91.2 Mathematica [C] (verified)
3.12.91.3 Rubi [A] (verified)
3.12.91.4 Maple [A] (verified)
3.12.91.5 Fricas [A] (verification not implemented)
3.12.91.6 Sympy [A] (verification not implemented)
3.12.91.7 Maxima [A] (verification not implemented)
3.12.91.8 Giac [B] (verification not implemented)
3.12.91.9 Mupad [B] (verification not implemented)

3.12.91.1 Optimal result

Integrand size = 23, antiderivative size = 140 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x)) \, dx=\left (a^3 c-3 a b^2 c-3 a^2 b d+b^3 d\right ) x-\frac {\left (3 a^2 b c-b^3 c+a^3 d-3 a b^2 d\right ) \log (\cos (e+f x))}{f}+\frac {b \left (2 a b c+a^2 d-b^2 d\right ) \tan (e+f x)}{f}+\frac {(b c+a d) (a+b \tan (e+f x))^2}{2 f}+\frac {d (a+b \tan (e+f x))^3}{3 f} \]

output
(a^3*c-3*a^2*b*d-3*a*b^2*c+b^3*d)*x-(a^3*d+3*a^2*b*c-3*a*b^2*d-b^3*c)*ln(c 
os(f*x+e))/f+b*(a^2*d+2*a*b*c-b^2*d)*tan(f*x+e)/f+1/2*(a*d+b*c)*(a+b*tan(f 
*x+e))^2/f+1/3*d*(a+b*tan(f*x+e))^3/f
 
3.12.91.2 Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 1.13 (sec) , antiderivative size = 130, normalized size of antiderivative = 0.93 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x)) \, dx=\frac {3 (a+i b)^3 (-i c+d) \log (i-\tan (e+f x))+3 (a-i b)^3 (i c+d) \log (i+\tan (e+f x))+6 b \left (3 a b c+3 a^2 d-b^2 d\right ) \tan (e+f x)+3 b^2 (b c+3 a d) \tan ^2(e+f x)+2 b^3 d \tan ^3(e+f x)}{6 f} \]

input
Integrate[(a + b*Tan[e + f*x])^3*(c + d*Tan[e + f*x]),x]
 
output
(3*(a + I*b)^3*((-I)*c + d)*Log[I - Tan[e + f*x]] + 3*(a - I*b)^3*(I*c + d 
)*Log[I + Tan[e + f*x]] + 6*b*(3*a*b*c + 3*a^2*d - b^2*d)*Tan[e + f*x] + 3 
*b^2*(b*c + 3*a*d)*Tan[e + f*x]^2 + 2*b^3*d*Tan[e + f*x]^3)/(6*f)
 
3.12.91.3 Rubi [A] (verified)

Time = 0.61 (sec) , antiderivative size = 140, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.348, Rules used = {3042, 4011, 3042, 4011, 3042, 4008, 3042, 3956}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x)) \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x))dx\)

\(\Big \downarrow \) 4011

\(\displaystyle \int (a+b \tan (e+f x))^2 (a c-b d+(b c+a d) \tan (e+f x))dx+\frac {d (a+b \tan (e+f x))^3}{3 f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (e+f x))^2 (a c-b d+(b c+a d) \tan (e+f x))dx+\frac {d (a+b \tan (e+f x))^3}{3 f}\)

\(\Big \downarrow \) 4011

\(\displaystyle \int (a+b \tan (e+f x)) \left (c a^2-2 b d a-b^2 c+\left (d a^2+2 b c a-b^2 d\right ) \tan (e+f x)\right )dx+\frac {(a d+b c) (a+b \tan (e+f x))^2}{2 f}+\frac {d (a+b \tan (e+f x))^3}{3 f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \int (a+b \tan (e+f x)) \left (c a^2-2 b d a-b^2 c+\left (d a^2+2 b c a-b^2 d\right ) \tan (e+f x)\right )dx+\frac {(a d+b c) (a+b \tan (e+f x))^2}{2 f}+\frac {d (a+b \tan (e+f x))^3}{3 f}\)

\(\Big \downarrow \) 4008

\(\displaystyle \left (a^3 d+3 a^2 b c-3 a b^2 d-b^3 c\right ) \int \tan (e+f x)dx+\frac {b \left (a^2 d+2 a b c-b^2 d\right ) \tan (e+f x)}{f}+x \left (a^3 c-3 a^2 b d-3 a b^2 c+b^3 d\right )+\frac {(a d+b c) (a+b \tan (e+f x))^2}{2 f}+\frac {d (a+b \tan (e+f x))^3}{3 f}\)

\(\Big \downarrow \) 3042

\(\displaystyle \left (a^3 d+3 a^2 b c-3 a b^2 d-b^3 c\right ) \int \tan (e+f x)dx+\frac {b \left (a^2 d+2 a b c-b^2 d\right ) \tan (e+f x)}{f}+x \left (a^3 c-3 a^2 b d-3 a b^2 c+b^3 d\right )+\frac {(a d+b c) (a+b \tan (e+f x))^2}{2 f}+\frac {d (a+b \tan (e+f x))^3}{3 f}\)

\(\Big \downarrow \) 3956

\(\displaystyle \frac {b \left (a^2 d+2 a b c-b^2 d\right ) \tan (e+f x)}{f}-\frac {\left (a^3 d+3 a^2 b c-3 a b^2 d-b^3 c\right ) \log (\cos (e+f x))}{f}+x \left (a^3 c-3 a^2 b d-3 a b^2 c+b^3 d\right )+\frac {(a d+b c) (a+b \tan (e+f x))^2}{2 f}+\frac {d (a+b \tan (e+f x))^3}{3 f}\)

input
Int[(a + b*Tan[e + f*x])^3*(c + d*Tan[e + f*x]),x]
 
output
(a^3*c - 3*a*b^2*c - 3*a^2*b*d + b^3*d)*x - ((3*a^2*b*c - b^3*c + a^3*d - 
3*a*b^2*d)*Log[Cos[e + f*x]])/f + (b*(2*a*b*c + a^2*d - b^2*d)*Tan[e + f*x 
])/f + ((b*c + a*d)*(a + b*Tan[e + f*x])^2)/(2*f) + (d*(a + b*Tan[e + f*x] 
)^3)/(3*f)
 

3.12.91.3.1 Defintions of rubi rules used

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4008
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.) 
*(x_)]), x_Symbol] :> Simp[(a*c - b*d)*x, x] + (Simp[b*d*(Tan[e + f*x]/f), 
x] + Simp[(b*c + a*d)   Int[Tan[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e, 
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]
 

rule 4011
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + 
 (f_.)*(x_)]), x_Symbol] :> Simp[d*((a + b*Tan[e + f*x])^m/(f*m)), x] + Int 
[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x], x] 
, x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 
 0] && GtQ[m, 0]
 
3.12.91.4 Maple [A] (verified)

Time = 0.20 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.01

method result size
norman \(\left (a^{3} c -3 a^{2} b d -3 a \,b^{2} c +b^{3} d \right ) x +\frac {b \left (3 a^{2} d +3 a b c -b^{2} d \right ) \tan \left (f x +e \right )}{f}+\frac {b^{2} \left (3 a d +b c \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {b^{3} d \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {\left (a^{3} d +3 a^{2} b c -3 a \,b^{2} d -b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}\) \(141\)
parts \(a^{3} c x +\frac {\left (3 a \,b^{2} d +b^{3} c \right ) \left (\frac {\left (\tan ^{2}\left (f x +e \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}\right )}{f}+\frac {\left (3 a^{2} b d +3 a \,b^{2} c \right ) \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+\frac {\left (a^{3} d +3 a^{2} b c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {b^{3} d \left (\frac {\left (\tan ^{3}\left (f x +e \right )\right )}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}\) \(147\)
derivativedivides \(\frac {\frac {b^{3} d \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {3 a \,b^{2} d \left (\tan ^{2}\left (f x +e \right )\right )}{2}+\frac {b^{3} c \left (\tan ^{2}\left (f x +e \right )\right )}{2}+3 a^{2} b d \tan \left (f x +e \right )+3 a \,b^{2} c \tan \left (f x +e \right )-b^{3} d \tan \left (f x +e \right )+\frac {\left (a^{3} d +3 a^{2} b c -3 a \,b^{2} d -b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c -3 a^{2} b d -3 a \,b^{2} c +b^{3} d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(159\)
default \(\frac {\frac {b^{3} d \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {3 a \,b^{2} d \left (\tan ^{2}\left (f x +e \right )\right )}{2}+\frac {b^{3} c \left (\tan ^{2}\left (f x +e \right )\right )}{2}+3 a^{2} b d \tan \left (f x +e \right )+3 a \,b^{2} c \tan \left (f x +e \right )-b^{3} d \tan \left (f x +e \right )+\frac {\left (a^{3} d +3 a^{2} b c -3 a \,b^{2} d -b^{3} c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{3} c -3 a^{2} b d -3 a \,b^{2} c +b^{3} d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) \(159\)
parallelrisch \(\frac {2 b^{3} d \left (\tan ^{3}\left (f x +e \right )\right )+6 a^{3} c f x -18 a^{2} b d f x -18 a \,b^{2} c f x +6 b^{3} d f x +9 a \,b^{2} d \left (\tan ^{2}\left (f x +e \right )\right )+3 b^{3} c \left (\tan ^{2}\left (f x +e \right )\right )+3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{3} d +9 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a^{2} b c -9 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) a \,b^{2} d -3 \ln \left (1+\tan ^{2}\left (f x +e \right )\right ) b^{3} c +18 a^{2} b d \tan \left (f x +e \right )+18 a \,b^{2} c \tan \left (f x +e \right )-6 b^{3} d \tan \left (f x +e \right )}{6 f}\) \(192\)
risch \(a^{3} c x -3 a^{2} b d x -3 a \,b^{2} c x +b^{3} d x -\frac {6 i a \,b^{2} d e}{f}+i a^{3} d x +3 i a^{2} b c x -3 i a \,b^{2} d x +\frac {2 i b \left (9 a^{2} d \,{\mathrm e}^{4 i \left (f x +e \right )}+9 a b c \,{\mathrm e}^{4 i \left (f x +e \right )}-6 b^{2} d \,{\mathrm e}^{4 i \left (f x +e \right )}-9 i a b d \,{\mathrm e}^{4 i \left (f x +e \right )}-3 i b^{2} c \,{\mathrm e}^{4 i \left (f x +e \right )}+18 a^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}+18 a b c \,{\mathrm e}^{2 i \left (f x +e \right )}-6 b^{2} d \,{\mathrm e}^{2 i \left (f x +e \right )}-9 i a b d \,{\mathrm e}^{2 i \left (f x +e \right )}-3 i b^{2} c \,{\mathrm e}^{2 i \left (f x +e \right )}+9 a^{2} d +9 a b c -4 b^{2} d \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}-i b^{3} c x +\frac {2 i a^{3} d e}{f}+\frac {6 i a^{2} b c e}{f}-\frac {2 i b^{3} c e}{f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{3} d}{f}-\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{2} b c}{f}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a \,b^{2} d}{f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) b^{3} c}{f}\) \(383\)

input
int((a+b*tan(f*x+e))^3*(c+d*tan(f*x+e)),x,method=_RETURNVERBOSE)
 
output
(a^3*c-3*a^2*b*d-3*a*b^2*c+b^3*d)*x+b*(3*a^2*d+3*a*b*c-b^2*d)/f*tan(f*x+e) 
+1/2*b^2*(3*a*d+b*c)/f*tan(f*x+e)^2+1/3*b^3*d/f*tan(f*x+e)^3+1/2*(a^3*d+3* 
a^2*b*c-3*a*b^2*d-b^3*c)/f*ln(1+tan(f*x+e)^2)
 
3.12.91.5 Fricas [A] (verification not implemented)

Time = 0.23 (sec) , antiderivative size = 147, normalized size of antiderivative = 1.05 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x)) \, dx=\frac {2 \, b^{3} d \tan \left (f x + e\right )^{3} + 6 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c - {\left (3 \, a^{2} b - b^{3}\right )} d\right )} f x + 3 \, {\left (b^{3} c + 3 \, a b^{2} d\right )} \tan \left (f x + e\right )^{2} - 3 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c + {\left (a^{3} - 3 \, a b^{2}\right )} d\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 6 \, {\left (3 \, a b^{2} c + {\left (3 \, a^{2} b - b^{3}\right )} d\right )} \tan \left (f x + e\right )}{6 \, f} \]

input
integrate((a+b*tan(f*x+e))^3*(c+d*tan(f*x+e)),x, algorithm="fricas")
 
output
1/6*(2*b^3*d*tan(f*x + e)^3 + 6*((a^3 - 3*a*b^2)*c - (3*a^2*b - b^3)*d)*f* 
x + 3*(b^3*c + 3*a*b^2*d)*tan(f*x + e)^2 - 3*((3*a^2*b - b^3)*c + (a^3 - 3 
*a*b^2)*d)*log(1/(tan(f*x + e)^2 + 1)) + 6*(3*a*b^2*c + (3*a^2*b - b^3)*d) 
*tan(f*x + e))/f
 
3.12.91.6 Sympy [A] (verification not implemented)

Time = 0.13 (sec) , antiderivative size = 240, normalized size of antiderivative = 1.71 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x)) \, dx=\begin {cases} a^{3} c x + \frac {a^{3} d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 a^{2} b c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - 3 a^{2} b d x + \frac {3 a^{2} b d \tan {\left (e + f x \right )}}{f} - 3 a b^{2} c x + \frac {3 a b^{2} c \tan {\left (e + f x \right )}}{f} - \frac {3 a b^{2} d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {3 a b^{2} d \tan ^{2}{\left (e + f x \right )}}{2 f} - \frac {b^{3} c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {b^{3} c \tan ^{2}{\left (e + f x \right )}}{2 f} + b^{3} d x + \frac {b^{3} d \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {b^{3} d \tan {\left (e + f x \right )}}{f} & \text {for}\: f \neq 0 \\x \left (a + b \tan {\left (e \right )}\right )^{3} \left (c + d \tan {\left (e \right )}\right ) & \text {otherwise} \end {cases} \]

input
integrate((a+b*tan(f*x+e))**3*(c+d*tan(f*x+e)),x)
 
output
Piecewise((a**3*c*x + a**3*d*log(tan(e + f*x)**2 + 1)/(2*f) + 3*a**2*b*c*l 
og(tan(e + f*x)**2 + 1)/(2*f) - 3*a**2*b*d*x + 3*a**2*b*d*tan(e + f*x)/f - 
 3*a*b**2*c*x + 3*a*b**2*c*tan(e + f*x)/f - 3*a*b**2*d*log(tan(e + f*x)**2 
 + 1)/(2*f) + 3*a*b**2*d*tan(e + f*x)**2/(2*f) - b**3*c*log(tan(e + f*x)** 
2 + 1)/(2*f) + b**3*c*tan(e + f*x)**2/(2*f) + b**3*d*x + b**3*d*tan(e + f* 
x)**3/(3*f) - b**3*d*tan(e + f*x)/f, Ne(f, 0)), (x*(a + b*tan(e))**3*(c + 
d*tan(e)), True))
 
3.12.91.7 Maxima [A] (verification not implemented)

Time = 0.33 (sec) , antiderivative size = 148, normalized size of antiderivative = 1.06 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x)) \, dx=\frac {2 \, b^{3} d \tan \left (f x + e\right )^{3} + 3 \, {\left (b^{3} c + 3 \, a b^{2} d\right )} \tan \left (f x + e\right )^{2} + 6 \, {\left ({\left (a^{3} - 3 \, a b^{2}\right )} c - {\left (3 \, a^{2} b - b^{3}\right )} d\right )} {\left (f x + e\right )} + 3 \, {\left ({\left (3 \, a^{2} b - b^{3}\right )} c + {\left (a^{3} - 3 \, a b^{2}\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 6 \, {\left (3 \, a b^{2} c + {\left (3 \, a^{2} b - b^{3}\right )} d\right )} \tan \left (f x + e\right )}{6 \, f} \]

input
integrate((a+b*tan(f*x+e))^3*(c+d*tan(f*x+e)),x, algorithm="maxima")
 
output
1/6*(2*b^3*d*tan(f*x + e)^3 + 3*(b^3*c + 3*a*b^2*d)*tan(f*x + e)^2 + 6*((a 
^3 - 3*a*b^2)*c - (3*a^2*b - b^3)*d)*(f*x + e) + 3*((3*a^2*b - b^3)*c + (a 
^3 - 3*a*b^2)*d)*log(tan(f*x + e)^2 + 1) + 6*(3*a*b^2*c + (3*a^2*b - b^3)* 
d)*tan(f*x + e))/f
 
3.12.91.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1751 vs. \(2 (136) = 272\).

Time = 1.39 (sec) , antiderivative size = 1751, normalized size of antiderivative = 12.51 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x)) \, dx=\text {Too large to display} \]

input
integrate((a+b*tan(f*x+e))^3*(c+d*tan(f*x+e)),x, algorithm="giac")
 
output
1/6*(6*a^3*c*f*x*tan(f*x)^3*tan(e)^3 - 18*a*b^2*c*f*x*tan(f*x)^3*tan(e)^3 
- 18*a^2*b*d*f*x*tan(f*x)^3*tan(e)^3 + 6*b^3*d*f*x*tan(f*x)^3*tan(e)^3 - 9 
*a^2*b*c*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*t 
an(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 + 3*b^3*c*log(4* 
(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f 
*x)^2 + tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 - 3*a^3*d*log(4*(tan(f*x)^2*tan 
(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^ 
2 + 1))*tan(f*x)^3*tan(e)^3 + 9*a*b^2*d*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan 
(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f 
*x)^3*tan(e)^3 - 18*a^3*c*f*x*tan(f*x)^2*tan(e)^2 + 54*a*b^2*c*f*x*tan(f*x 
)^2*tan(e)^2 + 54*a^2*b*d*f*x*tan(f*x)^2*tan(e)^2 - 18*b^3*d*f*x*tan(f*x)^ 
2*tan(e)^2 + 3*b^3*c*tan(f*x)^3*tan(e)^3 + 9*a*b^2*d*tan(f*x)^3*tan(e)^3 + 
 27*a^2*b*c*log(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^ 
2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 - 9*b^3*c*log 
(4*(tan(f*x)^2*tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + ta 
n(f*x)^2 + tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 + 9*a^3*d*log(4*(tan(f*x)^2* 
tan(e)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan( 
e)^2 + 1))*tan(f*x)^2*tan(e)^2 - 27*a*b^2*d*log(4*(tan(f*x)^2*tan(e)^2 - 2 
*tan(f*x)*tan(e) + 1)/(tan(f*x)^2*tan(e)^2 + tan(f*x)^2 + tan(e)^2 + 1))*t 
an(f*x)^2*tan(e)^2 - 18*a*b^2*c*tan(f*x)^3*tan(e)^2 - 18*a^2*b*d*tan(f*...
 
3.12.91.9 Mupad [B] (verification not implemented)

Time = 6.29 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.01 \[ \int (a+b \tan (e+f x))^3 (c+d \tan (e+f x)) \, dx=x\,\left (c\,a^3-3\,d\,a^2\,b-3\,c\,a\,b^2+d\,b^3\right )-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (b^3\,d-3\,a\,b\,\left (a\,d+b\,c\right )\right )}{f}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {c\,b^3}{2}+\frac {3\,a\,d\,b^2}{2}\right )}{f}+\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {d\,a^3}{2}+\frac {3\,c\,a^2\,b}{2}-\frac {3\,d\,a\,b^2}{2}-\frac {c\,b^3}{2}\right )}{f}+\frac {b^3\,d\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3\,f} \]

input
int((a + b*tan(e + f*x))^3*(c + d*tan(e + f*x)),x)
 
output
x*(a^3*c + b^3*d - 3*a*b^2*c - 3*a^2*b*d) - (tan(e + f*x)*(b^3*d - 3*a*b*( 
a*d + b*c)))/f + (tan(e + f*x)^2*((b^3*c)/2 + (3*a*b^2*d)/2))/f + (log(tan 
(e + f*x)^2 + 1)*((a^3*d)/2 - (b^3*c)/2 + (3*a^2*b*c)/2 - (3*a*b^2*d)/2))/ 
f + (b^3*d*tan(e + f*x)^3)/(3*f)